import sbt._

import Keys._
import AndroidKeys._

object General {
  val settings = Defaults.defaultSettings ++ Seq (
    name := "shuffle-synchronizer",
    version := "0.2.0",
    scalaVersion := "2.9.1",
    organization := "me.ycy.android",
    scalacOptions ++= Seq("-unchecked", "-deprecation"),
    libraryDependencies ++= Seq(
      "org.dodgybits" % "shuffle-android" % "1.7.3",
      "org.ektorp" % "org.ektorp" % "1.2.1",
      "org.slf4j" % "slf4j-jdk14" % "1.6.1"
    ),
    platformName in Android := "android-8"
  )


  lazy val fullAndroidSettings =
    General.settings ++
    AndroidProject.androidSettings ++
    // TypedResources.settings ++, this will cause error
    AndroidMarketPublish.settings ++ Seq (
      keyalias in Android := "change-me",
      proguardInJars in Android ++= ((file("lib") ** "*.jar") get), // this important
      useProguard in Android := true,
      proguardOption in Android := """
-keep class org.slf4j.impl.** { public protected private *; }
-keep class me.ycy.android.shuffle.synchronizer.ektorp.* { public protected *; }
-keepattributes *Annotation*
""",
      publishArtifact in (Compile, packageDoc) := false // generate doc will cause error, disable it
    )
}

object AndroidBuild extends Build {
  lazy val main = Project (
    "shuffle-synchronizer",
    file("."),
    settings = General.fullAndroidSettings
  )
}
